#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int bw(int x)
{
	return x / 100;
}
int sw(int x)
{
	return x / 10 % 10;
}
int gw(int x)
{
	return x % 10;
}
int main()
{
	for (int i = 123; i <= 329; i++)
	{
		if (bw(i) + sw(i) + gw(i) + bw(2 * i) + sw(2 * i) + gw(2 * i) + bw(3 * i) + sw(3 * i) + gw(3 * i) == 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9)
		{
			if (bw(i) * sw(i) * gw(i) * bw(2 * i) * sw(2 * i) * gw(2 * i) * bw(3 * i) * sw(3 * i) * gw(3 * i) == 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9)
			{
				cout << i << " " << 2 * i << " " << 3 * i << endl;
			}
		}
	}
	return 0;
}